package com.woniu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.dto.RealTimeMonitoring.ChargerInfoResponseDTO;
import com.woniu.dto.RealTimeMonitoring.WxxChargerListResponseDTO;
import com.woniu.entity.Charger;
import com.woniu.dto.RealTimeMonitoring.ChargerInfoRequestDTO;
import com.woniu.dto.RealTimeMonitoring.ChargerInfoResponseDTO;
import com.woniu.service.ChargerService;
import com.woniu.mapper.ChargerMapper;
import com.woniu.util.PageData;
import com.woniu.util.ResponseData;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Apricity
* @description 针对表【charger(充电桩表)】的数据库操作Service实现
* @createDate 2025-02-13 20:16:58
*/
@Service
@AllArgsConstructor
public class ChargerServiceImpl extends ServiceImpl<ChargerMapper, Charger>
    implements ChargerService{

    private ChargerMapper chargerMapper;
    @Override
    public ResponseData<?> getchargerListByStationId(PageData<ChargerInfoRequestDTO> pageParam) {
        ChargerInfoRequestDTO requestDTO = pageParam.getParam();
        PageHelper.startPage(pageParam.getPageNum(), pageParam.getPageSize());
        List<ChargerInfoResponseDTO> responseDTOList=chargerMapper.selectChargerInfoByStationId(requestDTO);
        PageInfo pageInfo=new PageInfo(responseDTOList);
        return new ResponseData<>().ok(pageInfo);
    }

    @Override
    public ResponseData<?> getchargerListByStationIdWx(ChargerInfoRequestDTO requestDTO) {
        List<WxxChargerListResponseDTO> responseDTOS=chargerMapper.selectChargerInfoByStationIdWx(requestDTO);
        System.out.println("responseDTOSWX"+responseDTOS);
        return new ResponseData<>().ok(responseDTOS);
    }

    @Override
    public ResponseData<?> getFee(ChargerInfoRequestDTO requestDTO) {
        String fee=chargerMapper.getFee(requestDTO);
        return new ResponseData<>().ok(fee);
    }
}




